﻿(function () {
    var appService = angular.module('serviceModule', []);

    appService.factory('Services', function ($rootScope, $filter) {
        var service = {};
        service.args = {};
        service.data = {};
        service.popupPorts = {};
        service.marker = {};
        service.markers = {};
        service.calc = {};
        service.total = {};
        service.Name = {};
        service.popup = {};
        service.order = {};
        service.initPopupLay = {};
        service.common = {};
        service.OC = {};
        service.box = {};
        service.changePort = {};
        service.changeOrder = {};
        service.selected = {};

        service.boxCheck = function (data) {
            this.box = data;
            $rootScope.$broadcast('boxCheck');
        };

        service.setOC = function (data) {
            this.OC = data;
            $rootScope.$broadcast('setOC');
        };

        service.setOC = function (data) {
            this.OC = data;
            $rootScope.$broadcast('setOC');
        };

        service.commonCalc = function (data) {
            this.common = data;
            $rootScope.$broadcast('commonCalc');
        };

        service.initPopupLay = function (data) {
            this.LayCan = data;
            $rootScope.$broadcast('initPopupLay');
        };

        service.changeOrderDate = function (data) {
            this.order = data;
            $rootScope.$broadcast('changeOrderDate');
        };

        service.initPopupDate = function (data) {
            this.popup = data;
            $rootScope.$broadcast('initPopupDate');
        };

        service.initPopup = function (data) {
            this.popupPorts = data;
            $rootScope.$broadcast('initPopup');
        };

        service.setName = function (data) {
            this.Name = data;
            $rootScope.$broadcast('setName');
        };

        service.update = function (args) {
            this.args = args;
            $rootScope.$broadcast('changeName');
        };

        service.markersUpdate = function (args) {
            this.markers = args;
            $rootScope.$broadcast('markersUpdate');
        };

        service.updateMarker = function (args) {
            service.marker = args;
            $rootScope.$broadcast('changeMarker');
        };

        service.changeDataArray = function (data) {
            service.data = data;
            $rootScope.$broadcast('changeDataArray');
        };

        service.updateCalc = function (data) {
            service.calc = data;
            $rootScope.$broadcast('updateCalc');
        };

        service.updateTotal = function (data) {
            service.total = data;
            $rootScope.$broadcast('updateTotal');
        };

        service.changePortDate = function (data) {
            service.changePort = data;
            $rootScope.$broadcast('changePortDate');
        };

        service.changeOrderTab = function (data) {
            service.changeOrder = data;
            $rootScope.$broadcast('changeOrderTab');
        };

        service.changeSelected = function (data) {
            service.selected = data;
            $rootScope.$broadcast('changeSelected');
        };

        return service;
    });
})()